<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:composition template="/template.xhtml">
	<ui:define name="titulo">jPress - #{locale.staticViewContatoTitulo}</ui:define>
	<ui:define name="body">
		<div id="body-system" style="max-width: 98%">
			<div id="body-title">
				<h3>#{locale.staticViewContatoTitulo}</h3>
			</div>
			<p:layout id="layout" style="min-width:400px; min-height:380px; max-height: 400px">	
				<p:layoutUnit position="west" resizable="false" size="500" minSize="400" maxSize="500" style="border:none">
					<p:panel header="#{locale.staticViewContatoTituloPanel}">
						<h:form>  
			       			 <h:panelGrid columns="2">
			       			 	<h:outputLabel for="nome" value="#{locale.staticViewContatoNome}:" style="font-weight: bold;" />
								<p:inputText id="nome" value="#{contatoBean.contato.nome}" required="true">
									<f:validateLength minimum="6" />
								</p:inputText>       			 	
			       			 	
			       			 	<h:outputLabel for="email" value="#{locale.staticViewContatoEmail}:" style="font-weight: bold;" />
								<p:inputText id="email" value="#{contatoBean.contato.email}" required="true">
									<f:validator validatorId="EmailValidator" />
								</p:inputText>
								      			 	
			       			 	<h:outputLabel for="assunto" value="#{locale.staticViewContatoAssunto}:" style="font-weight: bold;" />
								<p:inputText id="assunto" value="#{contatoBean.contato.assunto}" required="true">
									<f:validator validatorId="ThreeWordsValidator" />
								</p:inputText>
								       			 	
			       			 	<h:outputLabel for="mensagem" value="#{locale.staticViewContatoMensagem}:" style="font-weight: bold;" />
								<p:inputTextarea id="mensagem" value="#{contatoBean.contato.mensagem}" />       			 	
				     			
				     			<h:outputLabel for="mensagem" value="#{locale.captchaMessage}:" style="font-weight: bold;" />
				     			<p:captcha label="Captcha" 
				     				validatorMessage="#{locale.captchaValidatorMessage}"
				     				requiredMessage="#{locale.captchaRequiredMessage}"
				     			 />
				     			
				     			<p:commandButton value="#{locale.staticViewContatoBotaoEnviar}" actionListener="#{contatoBean.criarContato}" ajax="true" oncomplete="Recaptcha.reload()" update="growl, form2" />
				     			<p:commandButton type="reset" value="#{locale.staticViewContatoBotaoResetar}" /> 	
			       			 </h:panelGrid>  
			       		</h:form>		 
					</p:panel>  
				</p:layoutUnit>
				<p:layoutUnit position="center" style="border:none">
						<h:form id="form2">
							<p:dataList value="#{contatoBean.contatos}" var="contato" 
								paginator="true" rows="10" effectSpeed="fast"
								paginatorAlwaysVisible="false"
								paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink}">
								<f:facet name="header">
									#{locale.staticViewUltimosTituloPanel}
								</f:facet>
								<div style="padding: 5px;"> 
									<p:column>
										<p:commandLink style="padding: 5px; line-height: 30px; 	vertical-align:middle;" update=":form2:mensagemDetalhe" oncomplete="mensagemDialogo.show()" title="#{locale.staticViewContatoVerDetalhes}">
	                						<p:graphicImage value="${initParam.systemimages}icon_author.png" />
	                						<f:setPropertyActionListener value="#{contato}" target="#{contatoBean.selectContato}" /> 
										</p:commandLink>
										<h:outputText value="#{contato.nome}: #{contato.mensagem}" />
									</p:column>
								</div>
							</p:dataList>
							
							<p:dialog header="#{locale.staticViewContatoVerDetalhes} do autor" 
									  widgetVar="mensagemDialogo" modal="false" showEffect="fade" 
									  draggable="false" maximizable="false" resizable="false">
								<p:outputPanel id="mensagemDetalhe" style="text-align: left;" layout="block" >
									<h:panelGrid columns="2" cellpadding="5">

										<h:outputLabel style="font-weight: bold;"  for="nome" value="#{locale.staticViewContatoNome}:" />
										<h:outputText id="nome" value="#{contatoBean.selectContato.nome}" />
										
										<h:outputLabel style="font-weight: bold;" for="email" value="#{locale.staticViewContatoEmail}:" />
										<h:outputText id="email" value="#{contatoBean.selectContato.email}" />
										
									</h:panelGrid>
								</p:outputPanel>
							</p:dialog>
						</h:form>
				</p:layoutUnit>
				<div class="clear"></div>
			</p:layout>
		</div>
	</ui:define>
</ui:composition>
</html>